
package protocol;

import Utils.XoneUtil;
import app.BaseApplication;

import com.netease.http.THttpMethod;
import com.netease.http.THttpRequest;
import com.netease.pkgRelated.XoneConsts;

public class XoneHttpRequest extends THttpRequest {

    public static final String XONE_USER_AGENT = "X-User-Agent";
    public static final String XONE_PRODUCT = "XOne";
    public static final String USERAGENT = XONE_PRODUCT + "/"
            + XoneUtil.getNumberVersion(BaseApplication.getAppInstance()) + " ("
            + XoneConsts.APP_OS_NAME + "; " + XoneConsts.APP_SDK_SURPOT + "; " + android.os.Build.MODEL
            + "/android" + android.os.Build.VERSION.RELEASE + "; "
            + XoneUtil.getAppChannelID(BaseApplication.getAppInstance())+") " + XoneProtocol.XONE_PROTOCOL_NUMBER;

    public XoneHttpRequest(String url) {
        super(url);
        init();

    }

    public XoneHttpRequest(String url, THttpMethod type) {
        super(url, type);
        init();
    }

    public void init() {
        addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
        addHeader("Accept-Encoding", "gzip, deflate");
    }

    @Override
    public String getUrl() {
        addHeader(XONE_USER_AGENT,
                USERAGENT);
        return super.getUrl();
    }
}
